package com.lg.demo.provider;

import java.util.Date;

import com.lg.distributed.transaction.message.annotation.LgDistributedTransaction;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.amqp.core.Queue;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;

@Component
public class MessageSender {
	
	@Autowired
	private AmqpTemplate rabbitTemplate;

	public void send() {
		String context ="hello" + new Date();
		this.rabbitTemplate.convertAndSend("hello", context);
	}

	//@Autowired
	//@Qualifier("delayQueue")
	//private Queue queue;

	@LgDistributedTransaction(exchange = "exchange.transmsg",routingKey = "key.transmsg", bizName = "transtest",
	   dbCoordinator = "DBRedisCoordinator")
	public String transSend(){
		System.out.println("........trangsmsg send...........");
		return "hello world";
	}
}
